package jmine.tec.web.wicket.pages;

import bancosys.tec.exception.LocalizedMessageHolder;
import bancosys.tec.exception.MessageCreator;
import bancosys.tec.exception.MessageCreatorHelper;

/**
 * Enum que possui os HelpTexts do componente jmine-tec-web-wicket.
 * 
 * @author Rafael Volpato
 * @date Sep 15, 2011
 */
public enum HelpTextMessages implements MessageCreator {

    USUARIO_PERMISSOES(0, "jmine.tec.web.wicket.pages.security.UsuarioPermissoes");
    
    public static final String DEFAULT_BUNDLE = "jmine-tec-web-wicket-help";

    private final String bundle;

    private final String key;

    private final int nargs;

    /**
     * Construtor
     * 
     * @param nargs nargs
     * @param key key
     */
    private HelpTextMessages(int nargs, String key) {
        this(DEFAULT_BUNDLE, key, nargs);
    }

    /**
     * Construtor
     * 
     * @param bundle bundle
     * @param key key
     * @param nargs nargs
     */
    private HelpTextMessages(String bundle, String key, int nargs) {
        this.bundle = bundle;
        this.key = key;
        this.nargs = nargs;
    }

    /**
     * Cria um message holder de acordo com os argumentos
     * 
     * @param arguments arguments
     * @return message holder
     */
    public LocalizedMessageHolder create(Object... arguments) {
        return MessageCreatorHelper.create(this.bundle, this.key, this.nargs, arguments);
    }

    /**
     * {@inheritDoc}
     */
    public int getExpectedArguments() {
        return this.nargs;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String toString() {
        return "HelpTextMessages: bundle=" + this.bundle + " key=" + this.key;
    }
}
